import numpy as np
import math
#import newton_raphson as nr

#Question1


k=2
#X=np.array([0,5])
XY=np.array([[1.0],[1.0]])
x0=0
y0=0

#Elastic force

def elastic_force(k,X):
    Fe=np.array([[0], [0]])
    Fe[0]=-k*X[0]
    Fe[1]=-k*X[1]
    return Fe


#Centrifugal force

def centrifugal_force(k,XY):
    Fc=np.array([[0], [0]])
    Fc[0]=k*(XY[0]-x0)
    Fc[1]=k*(XY[1]-y0)
    return Fc

#Gravitational force

def gravitational_force(k,XY):
    Fg=np.array([[0.0],[0.0]])
    Fg[0]=-k*(XY[0]-x0)/(pow((pow((XY[0]-x0),2)+pow((XY[1]-y0),2)),1.5))
    Fg[1]=-k*(XY[1]-y0)/(pow((pow((XY[0]-x0),2)+pow((XY[1]-y0),2)),1.5))
    return Fg




#Question2
#nr(gravitational_force, 




#Test
k=2
#X=np.array([0,5])
#print elastic_force(k,X)
XY=np.array([[1.0],[1.0]])
x0=0
y0=0
#print centrifugal_force(k,XY)
#print gravitational_force(k,XY)
